package com.machine.tag;

import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;

import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.machine.dao.search.SearchDao;

public class TreeTag extends SimpleTagSupport {

	@Override
	public void doTag() throws JspException, IOException {
		PageContext pageContext = (PageContext) this.getJspContext();
		HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
	//	HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
		
		WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());
		SearchDao searchDao = (SearchDao) wac.getBean("SearchDao");
		
		
		request.setAttribute("list", searchDao.getKindNum());
		
	}

}
